#pragma once
#include <unordered_map>
#include "DirectoryBase.h"
#include "FileDescriptorFwd.h"
#include "Hash.h"

namespace ja2{ namespace vfs
{
	//! Library directory implementation.
	class DirectoryLibrary : public DirectoryBase
	{
		// Inner classes
	private:
		class IteratorImpl;

		// Typedefs
	private:
		typedef std::unordered_map<boost::filesystem::path, FileDescriptorPtr_t, hash_path> FileCatalog_t;

		// Attributes
	private:
		//! File catalog.
		FileCatalog_t m_FileCatalog;

		// Operations
	public:
		//! See base
		virtual FileProxy get_file(boost::filesystem::path const &File) const;
		//! See base.
		virtual bool file_exist(boost::filesystem::path const &File) const;
		//! See base.
		virtual PathVector_t get_sub_dirs() const;
		//! See base.
		virtual void add_file(FileDescriptorPtr_t const &pFileDesc, bool bDeleteOldFile = false);
		//! See base.
		virtual void create_subdirectory(boost::filesystem::path const &SubDir);
		//! See base.
		virtual void delete_subdirectory(boost::filesystem::path const& Dir);
		//! See base.
		virtual void delete_file(boost::filesystem::path const& File);
		//! See base
		virtual Iterator begin();
		//! See base.
		virtual Iterator end();

		// Construction/Destruction
	public:
		DirectoryLibrary(boost::filesystem::path const &MountPoint, boost::filesystem::path const &RealPath);
	};
} /*vfs*/} /*ja2*/